<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>科创研究成果平台</title>
<meta name="keywords" content="某某某有限公司">
<meta name="description" content="某某某有限公司">

<link href="css/main.css"  rel="stylesheet" />
<link href="css/style.css"  rel="stylesheet" />
<script src="js/jquery-1.8.3.min.js"  type="text/javascript"></script>
<script src="js/jquery.SuperSlide.2.1.1.js"></script>
<!--ie9以下调用-->
<!--[if lt IE 9]>
<script src="js/html5.js" ></script>
<script src="js/PIE.js" type="text/javascript"></script>
<![endif]-->

</head>
<body>
<!--头部-->
<header>
	<div class="beijing">
		<h2><a href="index.html" ><em><font color="white">科创研究成果平台</font></em></a></h2>
        <ul>
            <li>
                <a class="menu_1 "  href="index.html" >首页</a>
            </li>
            <li>
                <a class="menu_1 hover" href="news.html">资讯<em></em></a>
            </li>
            <li>
                <a class="menu_1 " href="act.html">活动<em></em></a>
            </li>
            <li>
                <a class="menu_1 " href="tech.html" >技术<em></em></a>
            </li>

            <li>
                <a class="menu_1 " href="cooper.html" >合作<em></em></a>
            </li>
            
            <li>
                <a class="menu_1 " href="person.html" >个人中心<em></em></a>
            </li>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
        </ul>
		<div class="clear"></div>		
	</div>
	<div class="clear"></div>
</header>

<div class="main_banner" style="background-image: url(./img/1843_src.jpg);height: 350px;">
	<img src="img/xin.jpg" alt="">
</div>
<!--主体-->
<div class="beijing1">
	<ul class="news" id="newsUl">
    	<!--<li><div class="xin_wu">-->
			<!--<a href="lie.html" >热烈祝贺某某某</a>-->
				<!--<span>2015-01-26</span>-->
    		<!--</div>-->
		<!--</li>-->
	</ul>
	<div class="page"> 
        <a  href="javascript:gotoPrevious()" class="page_prev">上一页 </a>   
        <a  href="#" class="thisclass">1</a>
        <a  href="javascript:gotoNext()"  class="page_next"> 下一页 </a>
    </div>
</div>

<footer class="ppp">
	<p style="font-size:13px;font-weight:bold"> Copyright 2018 科创研究成果平台  版权所有</p>
</footer>
<script type="text/javascript">
    var limit=5;
    var totalRow;
    var totalPage;
    $(document).ready(function () {
        var page=$(".thisclass").html();
        
        let data={'page':page,'rows':limit};
        $.ajax({
            url:"/news/search",
            type:"post",
            data:data,
            dataType: "json",//预期服务器返回的数据类型
            success: function (result) {
                for(var i=0;i<result.rows.length;i++){
                    console.log(result.rows[i].id);
                    var id=result.rows[i].id;
                    var head="details.html?id="+id;
                    $("#newsUl").append('<li><div class="xin_wu"><a href="'+head+'">'
                        +result.rows[i].title+'</a></div></li>');
                }
                totalRow=result.total;
                totalPage=Math.ceil(totalRow/limit);
            }
        });
    })
    
    function gotoPrevious(){
    	var page=Number($(".thisclass").html())-1;
    	if(page<1){
    		return;
    	}
    	let data={'page':page,'rows':limit};
    	$.ajax({
            url:"/news/search",
            type:"post",
            data:data,
            dataType: "json",//预期服务器返回的数据类型
            success: function (result) {
                console.log(result);//打印服
                $("#newsUl").children().remove();
                for(var i=0;i<result.rows.length;i++){
                    var head="details.html?id="+result.rows[i].id;
                    $("#newsUl").append('<li><div class="xin_wu"><a href="'+head+'">'
                        +result.rows[i].title+'</a></div></li>');
                }
                totalRow=result.total;
                totalPage=Math.ceil(totalRow/limit);
                $(".thisclass").html(page);
            }
        });
    }
    
    function gotoNext(){
        var page=Number($(".thisclass").html())+1;
        console.log("page:"+page);
        console.log("totalPage:"+totalPage);
        if(page>totalPage){
            return;
        }
        let data={'page':page,'rows':limit};
        $.ajax({
            url:"/news/search",
            type:"post",
            data:data,
            dataType: "json",//预期服务器返回的数据类型
            success: function (result) {
                console.log(result);//打印服
                $("#newsUl").children().remove();
                for(var i=0;i<result.rows.length;i++){
                    var head="details.html?id="+result.rows[i].id;
                    $("#newsUl").append('<li><div class="xin_wu"><a href="'+head+'">'
                        +result.rows[i].title+'</a></div></li>');
                }
                totalRow=result.total;
                totalPage=Math.ceil(totalRow/limit); 
                $(".thisclass").html(page);
            }
        });
    }
</script>
</body>

</html>

<script type="text/javascript" src="js/xmsz_common.js" ></script>
<!--[if IE 6]><script type="text/javascript" src="js/pngfix.js" ></script><![endif]-->
